<!DOCTYPE html>
<html lang="zh-Hans-CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorate="~{layout/default_layout}"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">

<!--content-->
<th:block layout:fragment="content">
    welcome <span sec:authentication="name">Admin</span>!
    <div sec:authorize="isAuthenticated()">
        <p>登录的用户为：<span sec:authentication="name"></span></p>
        <p>用户角色为：<span sec:authentication="principal.authorities"></span></p>
    </div>
    <hr/>
    <h2>Admin Links</h2>
    <a th:href="@{/admin/login}">sign in</a>
    <a th:href="@{/admin/page}">admin page</a>
    <div sec:authorize="isAuthenticated()">
        <a th:href="@{/admin/logout}">sign out</a>
    </div>
    <hr/>
    <h2>User Links</h2>
    <a th:href="@{/user/login}">sign in</a>
    <a th:href="@{/user/page}">user page</a>
    <div sec:authorize="isAuthenticated()">
        <a th:href="@{/user/logout}">sign out</a>
    </div>
    <hr/>
    <h2>Guest Links</h2>
    <a th:href="@{/guest}">guest page</a>
</th:block>

<!--script-->
<th:block layout:fragment="javascript">
    <script type="text/javascript">
        (function () {

        })();
    </script>
</th:block>